package basic.com.liz.learn.thread;

public class ProducerAndCustomer
{
    public static void main(String[] args)
    {
        /*
         * final static NumberFactory numberFactory = new NumberFactory();
         * 
         * public static void main(String[] args) { Thread a = new Thread(new Runnable() {
         * 
         * @Override public void run() { while (true) { numberFactory.createNum(); }
         * 
         * } });
         * 
         * a.start(); Thread b = new Thread(new Runnable() {
         * 
         * @Override public void run() { while (true) { numberFactory.consumer(); } } });
         * 
         * Thread c = new Thread(new Runnable() {
         * 
         * @Override public void run() { while (true) { numberFactory.consumer(); } } });
         * 
         * c.start();
         * 
         * Thread d = new Thread(new Runnable() {
         * 
         * @Override public void run() { while (true) { numberFactory.createNum(); }
         * 
         * } });
         * 
         * d.start(); }
         */
        
        Factory factory = new Factory();
        
        for (int i = 0; i < 2; i++)
        {
            new Thread(new Producer(factory)).start();
            new Thread(new Consumer(factory)).start();
        }
    }
    
}
